<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>png++: image.hpp Source File</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />



</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">png++
   &#160;<span id="projectnumber">0.2.1</span>
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.6.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="headertitle">
<div class="title">image.hpp</div>  </div>
</div><!--header-->
<div class="contents">
<a href="image_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment"> * Copyright (C) 2007,2008   Alex Shulgin</span>
<a name="l00003"></a>00003 <span class="comment"> *</span>
<a name="l00004"></a>00004 <span class="comment"> * This file is part of png++ the C++ wrapper for libpng.  PNG++ is free</span>
<a name="l00005"></a>00005 <span class="comment"> * software; the exact copying conditions are as follows:</span>
<a name="l00006"></a>00006 <span class="comment"> *</span>
<a name="l00007"></a>00007 <span class="comment"> * Redistribution and use in source and binary forms, with or without</span>
<a name="l00008"></a>00008 <span class="comment"> * modification, are permitted provided that the following conditions are met:</span>
<a name="l00009"></a>00009 <span class="comment"> *</span>
<a name="l00010"></a>00010 <span class="comment"> * 1. Redistributions of source code must retain the above copyright notice,</span>
<a name="l00011"></a>00011 <span class="comment"> * this list of conditions and the following disclaimer.</span>
<a name="l00012"></a>00012 <span class="comment"> *</span>
<a name="l00013"></a>00013 <span class="comment"> * 2. Redistributions in binary form must reproduce the above copyright</span>
<a name="l00014"></a>00014 <span class="comment"> * notice, this list of conditions and the following disclaimer in the</span>
<a name="l00015"></a>00015 <span class="comment"> * documentation and/or other materials provided with the distribution.</span>
<a name="l00016"></a>00016 <span class="comment"> *</span>
<a name="l00017"></a>00017 <span class="comment"> * 3. The name of the author may not be used to endorse or promote products</span>
<a name="l00018"></a>00018 <span class="comment"> * derived from this software without specific prior written permission.</span>
<a name="l00019"></a>00019 <span class="comment"> *</span>
<a name="l00020"></a>00020 <span class="comment"> * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS&#39;&#39; AND ANY EXPRESS OR</span>
<a name="l00021"></a>00021 <span class="comment"> * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES</span>
<a name="l00022"></a>00022 <span class="comment"> * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN</span>
<a name="l00023"></a>00023 <span class="comment"> * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,</span>
<a name="l00024"></a>00024 <span class="comment"> * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED</span>
<a name="l00025"></a>00025 <span class="comment"> * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR</span>
<a name="l00026"></a>00026 <span class="comment"> * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF</span>
<a name="l00027"></a>00027 <span class="comment"> * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING</span>
<a name="l00028"></a>00028 <span class="comment"> * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS</span>
<a name="l00029"></a>00029 <span class="comment"> * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span>
<a name="l00030"></a>00030 <span class="comment"> */</span>
<a name="l00031"></a>00031 <span class="preprocessor">#ifndef PNGPP_IMAGE_HPP_INCLUDED</span>
<a name="l00032"></a>00032 <span class="preprocessor"></span><span class="preprocessor">#define PNGPP_IMAGE_HPP_INCLUDED</span>
<a name="l00033"></a>00033 <span class="preprocessor"></span>
<a name="l00034"></a>00034 <span class="preprocessor">#include &lt;fstream&gt;</span>
<a name="l00035"></a>00035 <span class="preprocessor">#include &quot;<a class="code" href="pixel__buffer_8hpp.html">pixel_buffer.hpp</a>&quot;</span>
<a name="l00036"></a>00036 <span class="preprocessor">#include &quot;<a class="code" href="generator_8hpp.html">generator.hpp</a>&quot;</span>
<a name="l00037"></a>00037 <span class="preprocessor">#include &quot;<a class="code" href="consumer_8hpp.html">consumer.hpp</a>&quot;</span>
<a name="l00038"></a>00038 <span class="preprocessor">#include &quot;<a class="code" href="convert__color__space_8hpp.html">convert_color_space.hpp</a>&quot;</span>
<a name="l00039"></a>00039 
<a name="l00040"></a>00040 <span class="keyword">namespace </span>png
<a name="l00041"></a>00041 {
<a name="l00042"></a>00042 
<a name="l00051"></a>00051     <span class="keyword">template</span>&lt; <span class="keyword">typename</span> pixel &gt;
<a name="l00052"></a><a class="code" href="classpng_1_1image.html">00052</a>     <span class="keyword">class </span><a class="code" href="classpng_1_1image.html" title="Class template to represent PNG image.">image</a>
<a name="l00053"></a>00053     {
<a name="l00054"></a>00054     <span class="keyword">public</span>:
<a name="l00058"></a><a class="code" href="classpng_1_1image.html#a6a828d5ae19727b486cddab99627a711">00058</a>         <span class="keyword">typedef</span> pixel_traits&lt; pixel &gt; <a class="code" href="classpng_1_1image.html#a6a828d5ae19727b486cddab99627a711" title="The pixel traits type for pixel.">traits</a>;
<a name="l00059"></a>00059 
<a name="l00063"></a><a class="code" href="classpng_1_1image.html#a18629fd28aaeb35bccbdf0c4d8715924">00063</a>         <span class="keyword">typedef</span> <a class="code" href="classpng_1_1pixel__buffer.html">pixel_buffer&lt; pixel &gt;</a> <a class="code" href="classpng_1_1image.html#a18629fd28aaeb35bccbdf0c4d8715924" title="The pixel buffer type for pixel.">pixbuf</a>;
<a name="l00064"></a>00064 
<a name="l00068"></a><a class="code" href="classpng_1_1image.html#a03b16c0f375b4012c4296a1216e793a0">00068</a>         <span class="keyword">typedef</span> <span class="keyword">typename</span> <a class="code" href="classpng_1_1basic__pixel__buffer.html#a9f613598fdbb2097bb6e2106430a3fcf" title="A row of pixel data.">pixbuf::row_type</a> <a class="code" href="classpng_1_1image.html#a03b16c0f375b4012c4296a1216e793a0" title="Represents a row of image pixel data.">row_type</a>;
<a name="l00069"></a>00069 
<a name="l00074"></a><a class="code" href="classpng_1_1image.html#a1bc0c1b88d04dcc0f70ac7d67c3a6603">00074</a>         <span class="keyword">typedef</span> <a class="code" href="structpng_1_1convert__color__space.html" title="IO transformation class template. Converts image color space.">convert_color_space&lt; pixel &gt;</a> <a class="code" href="classpng_1_1image.html#a1bc0c1b88d04dcc0f70ac7d67c3a6603" title="A transformation functor to convert any image to appropriate color space.">transform_convert</a>;
<a name="l00075"></a>00075 
<a name="l00079"></a><a class="code" href="structpng_1_1image_1_1transform__identity.html">00079</a>         <span class="keyword">struct </span><a class="code" href="structpng_1_1image_1_1transform__identity.html" title="The default io transformation: does nothing.">transform_identity</a>
<a name="l00080"></a>00080         {
<a name="l00081"></a><a class="code" href="structpng_1_1image_1_1transform__identity.html#accf5b8bd21cf86a76cccf0033353772a">00081</a>             <span class="keywordtype">void</span> <a class="code" href="structpng_1_1image_1_1transform__identity.html#accf5b8bd21cf86a76cccf0033353772a">operator()</a>(<a class="code" href="classpng_1_1io__base.html" title="Base class for PNG reader/writer classes.">io_base</a>&amp;)<span class="keyword"> const </span>{}
<a name="l00082"></a>00082         };
<a name="l00083"></a>00083 
<a name="l00087"></a><a class="code" href="classpng_1_1image.html#ad3f6ced953ad30e9f7314e59b8d01ddb">00087</a>         <a class="code" href="classpng_1_1image.html#ad3f6ced953ad30e9f7314e59b8d01ddb" title="Constructs an empty image.">image</a>()
<a name="l00088"></a>00088             : <a class="code" href="classpng_1_1image.html#a632aa91a796f04152206369cc4403060">m_info</a>(<a class="code" href="namespacepng.html#a0382f7c737de4af757becbb39cc3f5ae" title="Returns an image_info object with color_type and bit_depth fields setup appropriate for the pixel typ...">make_image_info</a>&lt; pixel &gt;())
<a name="l00089"></a>00089         {
<a name="l00090"></a>00090         }
<a name="l00091"></a>00091 
<a name="l00095"></a><a class="code" href="classpng_1_1image.html#aa4a71e65c50d56b9f4c98eedf4c5b1a3">00095</a>         <a class="code" href="classpng_1_1image.html#ad3f6ced953ad30e9f7314e59b8d01ddb" title="Constructs an empty image.">image</a>(<span class="keywordtype">size_t</span> width, <span class="keywordtype">size_t</span> height)
<a name="l00096"></a>00096             : <a class="code" href="classpng_1_1image.html#a632aa91a796f04152206369cc4403060">m_info</a>(<a class="code" href="namespacepng.html#a0382f7c737de4af757becbb39cc3f5ae" title="Returns an image_info object with color_type and bit_depth fields setup appropriate for the pixel typ...">make_image_info</a>&lt; pixel &gt;())
<a name="l00097"></a>00097         {
<a name="l00098"></a>00098             <a class="code" href="classpng_1_1image.html#a1438f7509e906edf364ec5d4d31ece0d" title="Resizes the image pixel buffer.">resize</a>(width, height);
<a name="l00099"></a>00099         }
<a name="l00100"></a>00100 
<a name="l00105"></a><a class="code" href="classpng_1_1image.html#a9485519ce9e338e5f5d383202f4a1e2d">00105</a>         <span class="keyword">explicit</span> <a class="code" href="classpng_1_1image.html#ad3f6ced953ad30e9f7314e59b8d01ddb" title="Constructs an empty image.">image</a>(std::string <span class="keyword">const</span>&amp; filename)
<a name="l00106"></a>00106         {
<a name="l00107"></a>00107             <a class="code" href="classpng_1_1image.html#a39b167f639856afe5fb3dc666e66df2d" title="Reads an image from specified file using default converting transform.">read</a>(filename, <a class="code" href="classpng_1_1image.html#a1bc0c1b88d04dcc0f70ac7d67c3a6603" title="A transformation functor to convert any image to appropriate color space.">transform_convert</a>());
<a name="l00108"></a>00108         }
<a name="l00109"></a>00109 
<a name="l00114"></a>00114         <span class="keyword">template</span>&lt; <span class="keyword">class</span> transformation &gt;
<a name="l00115"></a><a class="code" href="classpng_1_1image.html#aad797554233bafee290dbe411eb203ca">00115</a>         <a class="code" href="classpng_1_1image.html#ad3f6ced953ad30e9f7314e59b8d01ddb" title="Constructs an empty image.">image</a>(std::string <span class="keyword">const</span>&amp; filename,
<a name="l00116"></a>00116               transformation <span class="keyword">const</span>&amp; transform)
<a name="l00117"></a>00117         {
<a name="l00118"></a>00118             <a class="code" href="classpng_1_1image.html#a39b167f639856afe5fb3dc666e66df2d" title="Reads an image from specified file using default converting transform.">read</a>(filename.c_str(), transform);
<a name="l00119"></a>00119         }
<a name="l00120"></a>00120 
<a name="l00125"></a><a class="code" href="classpng_1_1image.html#a55a47368c2b3219b9ae0a18411bd8f6c">00125</a>         <span class="keyword">explicit</span> <a class="code" href="classpng_1_1image.html#ad3f6ced953ad30e9f7314e59b8d01ddb" title="Constructs an empty image.">image</a>(<span class="keywordtype">char</span> <span class="keyword">const</span>* filename)
<a name="l00126"></a>00126         {
<a name="l00127"></a>00127             <a class="code" href="classpng_1_1image.html#a39b167f639856afe5fb3dc666e66df2d" title="Reads an image from specified file using default converting transform.">read</a>(filename, <a class="code" href="classpng_1_1image.html#a1bc0c1b88d04dcc0f70ac7d67c3a6603" title="A transformation functor to convert any image to appropriate color space.">transform_convert</a>());
<a name="l00128"></a>00128         }
<a name="l00129"></a>00129 
<a name="l00134"></a>00134         <span class="keyword">template</span>&lt; <span class="keyword">class</span> transformation &gt;
<a name="l00135"></a><a class="code" href="classpng_1_1image.html#a01a3ee929229f6a9d5a7ed3e871f714c">00135</a>         <a class="code" href="classpng_1_1image.html#ad3f6ced953ad30e9f7314e59b8d01ddb" title="Constructs an empty image.">image</a>(<span class="keywordtype">char</span> <span class="keyword">const</span>* filename, transformation <span class="keyword">const</span>&amp; transform)
<a name="l00136"></a>00136         {
<a name="l00137"></a>00137             <a class="code" href="classpng_1_1image.html#a39b167f639856afe5fb3dc666e66df2d" title="Reads an image from specified file using default converting transform.">read</a>(filename, transform);
<a name="l00138"></a>00138         }
<a name="l00139"></a>00139 
<a name="l00144"></a><a class="code" href="classpng_1_1image.html#aa8d31436b1e662d22b335563570b83c7">00144</a>         <span class="keyword">explicit</span> <a class="code" href="classpng_1_1image.html#ad3f6ced953ad30e9f7314e59b8d01ddb" title="Constructs an empty image.">image</a>(std::istream&amp; stream)
<a name="l00145"></a>00145         {
<a name="l00146"></a>00146             <a class="code" href="classpng_1_1image.html#ac05a4cb00c601a9c7995043124786fde" title="Reads an image from a stream using default converting transform.">read_stream</a>(stream, <a class="code" href="classpng_1_1image.html#a1bc0c1b88d04dcc0f70ac7d67c3a6603" title="A transformation functor to convert any image to appropriate color space.">transform_convert</a>());
<a name="l00147"></a>00147         }
<a name="l00148"></a>00148 
<a name="l00153"></a>00153         <span class="keyword">template</span>&lt; <span class="keyword">class</span> transformation &gt;
<a name="l00154"></a><a class="code" href="classpng_1_1image.html#af678430994dab1150b7008fb86906a96">00154</a>         <a class="code" href="classpng_1_1image.html#ad3f6ced953ad30e9f7314e59b8d01ddb" title="Constructs an empty image.">image</a>(std::istream&amp; stream, transformation <span class="keyword">const</span>&amp; transform)
<a name="l00155"></a>00155         {
<a name="l00156"></a>00156             <a class="code" href="classpng_1_1image.html#ac05a4cb00c601a9c7995043124786fde" title="Reads an image from a stream using default converting transform.">read_stream</a>(stream, transform);
<a name="l00157"></a>00157         }
<a name="l00158"></a>00158 
<a name="l00163"></a><a class="code" href="classpng_1_1image.html#a39b167f639856afe5fb3dc666e66df2d">00163</a>         <span class="keywordtype">void</span> <a class="code" href="classpng_1_1image.html#a39b167f639856afe5fb3dc666e66df2d" title="Reads an image from specified file using default converting transform.">read</a>(std::string <span class="keyword">const</span>&amp; filename)
<a name="l00164"></a>00164         {
<a name="l00165"></a>00165             <a class="code" href="classpng_1_1image.html#a39b167f639856afe5fb3dc666e66df2d" title="Reads an image from specified file using default converting transform.">read</a>(filename, <a class="code" href="classpng_1_1image.html#a1bc0c1b88d04dcc0f70ac7d67c3a6603" title="A transformation functor to convert any image to appropriate color space.">transform_convert</a>());
<a name="l00166"></a>00166         }
<a name="l00167"></a>00167 
<a name="l00172"></a>00172         <span class="keyword">template</span>&lt; <span class="keyword">class</span> transformation &gt;
<a name="l00173"></a><a class="code" href="classpng_1_1image.html#ae417f7c3637697774e743d5d27c9941a">00173</a>         <span class="keywordtype">void</span> <a class="code" href="classpng_1_1image.html#a39b167f639856afe5fb3dc666e66df2d" title="Reads an image from specified file using default converting transform.">read</a>(std::string <span class="keyword">const</span>&amp; filename, transformation <span class="keyword">const</span>&amp; transform)
<a name="l00174"></a>00174         {
<a name="l00175"></a>00175             <a class="code" href="classpng_1_1image.html#a39b167f639856afe5fb3dc666e66df2d" title="Reads an image from specified file using default converting transform.">read</a>(filename.c_str(), transform);
<a name="l00176"></a>00176         }
<a name="l00177"></a>00177 
<a name="l00182"></a><a class="code" href="classpng_1_1image.html#a48a9064b6b150f802e2f3c54878a88f4">00182</a>         <span class="keywordtype">void</span> <a class="code" href="classpng_1_1image.html#a39b167f639856afe5fb3dc666e66df2d" title="Reads an image from specified file using default converting transform.">read</a>(<span class="keywordtype">char</span> <span class="keyword">const</span>* filename)
<a name="l00183"></a>00183         {
<a name="l00184"></a>00184             <a class="code" href="classpng_1_1image.html#a39b167f639856afe5fb3dc666e66df2d" title="Reads an image from specified file using default converting transform.">read</a>(filename, <a class="code" href="classpng_1_1image.html#a1bc0c1b88d04dcc0f70ac7d67c3a6603" title="A transformation functor to convert any image to appropriate color space.">transform_convert</a>());
<a name="l00185"></a>00185         }
<a name="l00186"></a>00186 
<a name="l00191"></a>00191         <span class="keyword">template</span>&lt; <span class="keyword">class</span> transformation &gt;
<a name="l00192"></a><a class="code" href="classpng_1_1image.html#aef17340a4922ca233e3c278b33f34f54">00192</a>         <span class="keywordtype">void</span> <a class="code" href="classpng_1_1image.html#a39b167f639856afe5fb3dc666e66df2d" title="Reads an image from specified file using default converting transform.">read</a>(<span class="keywordtype">char</span> <span class="keyword">const</span>* filename, transformation <span class="keyword">const</span>&amp; transform)
<a name="l00193"></a>00193         {
<a name="l00194"></a>00194             std::ifstream stream(filename, std::ios::binary);
<a name="l00195"></a>00195             <span class="keywordflow">if</span> (!stream.is_open())
<a name="l00196"></a>00196             {
<a name="l00197"></a>00197                 <span class="keywordflow">throw</span> <a class="code" href="classpng_1_1std__error.html" title="Exception class to represent standard library errors (generally IO).">std_error</a>(filename);
<a name="l00198"></a>00198             }
<a name="l00199"></a>00199             stream.exceptions(std::ios::badbit);
<a name="l00200"></a>00200             <a class="code" href="classpng_1_1image.html#ac05a4cb00c601a9c7995043124786fde" title="Reads an image from a stream using default converting transform.">read_stream</a>(stream, transform);
<a name="l00201"></a>00201         }
<a name="l00202"></a>00202 
<a name="l00207"></a><a class="code" href="classpng_1_1image.html#a90c659eaef8588b9fa77a736251776d8">00207</a>         <span class="keywordtype">void</span> <a class="code" href="classpng_1_1image.html#a39b167f639856afe5fb3dc666e66df2d" title="Reads an image from specified file using default converting transform.">read</a>(std::istream&amp; stream)
<a name="l00208"></a>00208         {
<a name="l00209"></a>00209             <a class="code" href="classpng_1_1image.html#ac05a4cb00c601a9c7995043124786fde" title="Reads an image from a stream using default converting transform.">read_stream</a>(stream, <a class="code" href="classpng_1_1image.html#a1bc0c1b88d04dcc0f70ac7d67c3a6603" title="A transformation functor to convert any image to appropriate color space.">transform_convert</a>());
<a name="l00210"></a>00210         }
<a name="l00211"></a>00211 
<a name="l00216"></a>00216         <span class="keyword">template</span>&lt; <span class="keyword">class</span> transformation &gt;
<a name="l00217"></a><a class="code" href="classpng_1_1image.html#a9c20a85976678b3521a2826de75a4198">00217</a>         <span class="keywordtype">void</span> <a class="code" href="classpng_1_1image.html#a39b167f639856afe5fb3dc666e66df2d" title="Reads an image from specified file using default converting transform.">read</a>(std::istream&amp; stream, transformation <span class="keyword">const</span>&amp; transform)
<a name="l00218"></a>00218         {
<a name="l00219"></a>00219             <a class="code" href="classpng_1_1image.html#ac05a4cb00c601a9c7995043124786fde" title="Reads an image from a stream using default converting transform.">read_stream</a>(stream, transform);
<a name="l00220"></a>00220         }
<a name="l00221"></a>00221 
<a name="l00226"></a>00226         <span class="keyword">template</span>&lt; <span class="keyword">class</span> istream &gt;
<a name="l00227"></a><a class="code" href="classpng_1_1image.html#ac05a4cb00c601a9c7995043124786fde">00227</a>         <span class="keywordtype">void</span> <a class="code" href="classpng_1_1image.html#ac05a4cb00c601a9c7995043124786fde" title="Reads an image from a stream using default converting transform.">read_stream</a>(istream&amp; stream)
<a name="l00228"></a>00228         {
<a name="l00229"></a>00229             <a class="code" href="classpng_1_1image.html#ac05a4cb00c601a9c7995043124786fde" title="Reads an image from a stream using default converting transform.">read_stream</a>(stream, <a class="code" href="classpng_1_1image.html#a1bc0c1b88d04dcc0f70ac7d67c3a6603" title="A transformation functor to convert any image to appropriate color space.">transform_convert</a>());
<a name="l00230"></a>00230         }
<a name="l00231"></a>00231 
<a name="l00236"></a>00236         <span class="keyword">template</span>&lt; <span class="keyword">class</span> istream, <span class="keyword">class</span> transformation &gt;
<a name="l00237"></a><a class="code" href="classpng_1_1image.html#aa214828cdeb0cbffc2dcdbe7f9279116">00237</a>         <span class="keywordtype">void</span> <a class="code" href="classpng_1_1image.html#ac05a4cb00c601a9c7995043124786fde" title="Reads an image from a stream using default converting transform.">read_stream</a>(istream&amp; stream, transformation <span class="keyword">const</span>&amp; transform)
<a name="l00238"></a>00238         {
<a name="l00239"></a>00239             <a class="code" href="classpng_1_1image_1_1pixel__consumer.html" title="The pixel buffer adapter for reading pixel data.">pixel_consumer</a> pixcon(<a class="code" href="classpng_1_1image.html#a632aa91a796f04152206369cc4403060">m_info</a>, <a class="code" href="classpng_1_1image.html#aabd729d366a48f7004c9b169d8783049">m_pixbuf</a>);
<a name="l00240"></a>00240             pixcon.read(stream, transform);
<a name="l00241"></a>00241         }
<a name="l00242"></a>00242 
<a name="l00246"></a><a class="code" href="classpng_1_1image.html#afd2cc57ec02efce3103573fba054a4aa">00246</a>         <span class="keywordtype">void</span> <a class="code" href="classpng_1_1image.html#afd2cc57ec02efce3103573fba054a4aa" title="Writes an image to specified file.">write</a>(std::string <span class="keyword">const</span>&amp; filename)
<a name="l00247"></a>00247         {
<a name="l00248"></a>00248             <a class="code" href="classpng_1_1image.html#afd2cc57ec02efce3103573fba054a4aa" title="Writes an image to specified file.">write</a>(filename.c_str());
<a name="l00249"></a>00249         }
<a name="l00250"></a>00250 
<a name="l00254"></a><a class="code" href="classpng_1_1image.html#aef4cde536f51f367925253fb8f87628c">00254</a>         <span class="keywordtype">void</span> <a class="code" href="classpng_1_1image.html#afd2cc57ec02efce3103573fba054a4aa" title="Writes an image to specified file.">write</a>(<span class="keywordtype">char</span> <span class="keyword">const</span>* filename)
<a name="l00255"></a>00255         {
<a name="l00256"></a>00256             std::ofstream stream(filename, std::ios::binary);
<a name="l00257"></a>00257             <span class="keywordflow">if</span> (!stream.is_open())
<a name="l00258"></a>00258             {
<a name="l00259"></a>00259                 <span class="keywordflow">throw</span> <a class="code" href="classpng_1_1std__error.html" title="Exception class to represent standard library errors (generally IO).">std_error</a>(filename);
<a name="l00260"></a>00260             }
<a name="l00261"></a>00261             stream.exceptions(std::ios::badbit);
<a name="l00262"></a>00262             <a class="code" href="classpng_1_1image.html#a717b2da00897c5b3b1e0565f16a917ed" title="Writes an image to a stream.">write_stream</a>(stream);
<a name="l00263"></a>00263         }
<a name="l00264"></a>00264 
<a name="l00268"></a><a class="code" href="classpng_1_1image.html#a717b2da00897c5b3b1e0565f16a917ed">00268</a>         <span class="keywordtype">void</span> <a class="code" href="classpng_1_1image.html#a717b2da00897c5b3b1e0565f16a917ed" title="Writes an image to a stream.">write_stream</a>(std::ostream&amp; stream)
<a name="l00269"></a>00269         {
<a name="l00270"></a>00270             <a class="code" href="classpng_1_1image.html#a717b2da00897c5b3b1e0565f16a917ed" title="Writes an image to a stream.">write_stream</a>(stream);
<a name="l00271"></a>00271         }
<a name="l00272"></a>00272 
<a name="l00276"></a>00276         <span class="keyword">template</span>&lt; <span class="keyword">class</span> ostream &gt;
<a name="l00277"></a><a class="code" href="classpng_1_1image.html#af281589df5de77d47fb7ceab0454a8d4">00277</a>         <span class="keywordtype">void</span> <a class="code" href="classpng_1_1image.html#a717b2da00897c5b3b1e0565f16a917ed" title="Writes an image to a stream.">write_stream</a>(ostream&amp; stream)
<a name="l00278"></a>00278         {
<a name="l00279"></a>00279             <a class="code" href="classpng_1_1image_1_1pixel__generator.html" title="The pixel buffer adapter for writing pixel data.">pixel_generator</a> pixgen(<a class="code" href="classpng_1_1image.html#a632aa91a796f04152206369cc4403060">m_info</a>, <a class="code" href="classpng_1_1image.html#aabd729d366a48f7004c9b169d8783049">m_pixbuf</a>);
<a name="l00280"></a>00280             pixgen.write(stream);
<a name="l00281"></a>00281         }
<a name="l00282"></a>00282 
<a name="l00286"></a><a class="code" href="classpng_1_1image.html#acb006a95ec41a44bf573fb79a5a08229">00286</a>         <a class="code" href="classpng_1_1pixel__buffer.html">pixbuf</a>&amp; <a class="code" href="classpng_1_1image.html#acb006a95ec41a44bf573fb79a5a08229" title="Returns a reference to image pixel buffer.">get_pixbuf</a>()
<a name="l00287"></a>00287         {
<a name="l00288"></a>00288             <span class="keywordflow">return</span> <a class="code" href="classpng_1_1image.html#aabd729d366a48f7004c9b169d8783049">m_pixbuf</a>;
<a name="l00289"></a>00289         }
<a name="l00290"></a>00290         
<a name="l00294"></a><a class="code" href="classpng_1_1image.html#ad74ce2aea35a06cf417c14ffb2b0bdf5">00294</a>         <a class="code" href="classpng_1_1pixel__buffer.html">pixbuf</a> <span class="keyword">const</span>&amp; <a class="code" href="classpng_1_1image.html#acb006a95ec41a44bf573fb79a5a08229" title="Returns a reference to image pixel buffer.">get_pixbuf</a>()<span class="keyword"> const</span>
<a name="l00295"></a>00295 <span class="keyword">        </span>{
<a name="l00296"></a>00296             <span class="keywordflow">return</span> <a class="code" href="classpng_1_1image.html#aabd729d366a48f7004c9b169d8783049">m_pixbuf</a>;
<a name="l00297"></a>00297         }
<a name="l00298"></a>00298 
<a name="l00304"></a><a class="code" href="classpng_1_1image.html#a8b9692e536505a95e0bea9fef1c4257d">00304</a>         <span class="keywordtype">void</span> <a class="code" href="classpng_1_1image.html#a8b9692e536505a95e0bea9fef1c4257d" title="Replaces the image pixel buffer.">set_pixbuf</a>(<a class="code" href="classpng_1_1pixel__buffer.html">pixbuf</a> <span class="keyword">const</span>&amp; buffer)
<a name="l00305"></a>00305         {
<a name="l00306"></a>00306             <a class="code" href="classpng_1_1image.html#aabd729d366a48f7004c9b169d8783049">m_pixbuf</a> = buffer;
<a name="l00307"></a>00307         }
<a name="l00308"></a>00308 
<a name="l00309"></a><a class="code" href="classpng_1_1image.html#a381477824c5c49c922abf7a050b4a7f3">00309</a>         <span class="keywordtype">size_t</span> <a class="code" href="classpng_1_1image.html#a381477824c5c49c922abf7a050b4a7f3">get_width</a>()<span class="keyword"> const</span>
<a name="l00310"></a>00310 <span class="keyword">        </span>{
<a name="l00311"></a>00311             <span class="keywordflow">return</span> <a class="code" href="classpng_1_1image.html#aabd729d366a48f7004c9b169d8783049">m_pixbuf</a>.<a class="code" href="classpng_1_1basic__pixel__buffer.html#a08653f32687d377b91c44848f7a4a7e5">get_width</a>();
<a name="l00312"></a>00312         }
<a name="l00313"></a>00313 
<a name="l00314"></a><a class="code" href="classpng_1_1image.html#a2b7a1e585b83533491dca1437072d7c6">00314</a>         <span class="keywordtype">size_t</span> <a class="code" href="classpng_1_1image.html#a2b7a1e585b83533491dca1437072d7c6">get_height</a>()<span class="keyword"> const</span>
<a name="l00315"></a>00315 <span class="keyword">        </span>{
<a name="l00316"></a>00316             <span class="keywordflow">return</span> <a class="code" href="classpng_1_1image.html#aabd729d366a48f7004c9b169d8783049">m_pixbuf</a>.<a class="code" href="classpng_1_1basic__pixel__buffer.html#ac358ea2cde969c8a356983dd0e00d84d">get_height</a>();
<a name="l00317"></a>00317         }
<a name="l00318"></a>00318 
<a name="l00322"></a><a class="code" href="classpng_1_1image.html#a1438f7509e906edf364ec5d4d31ece0d">00322</a>         <span class="keywordtype">void</span> <a class="code" href="classpng_1_1image.html#a1438f7509e906edf364ec5d4d31ece0d" title="Resizes the image pixel buffer.">resize</a>(<span class="keywordtype">size_t</span> width, <span class="keywordtype">size_t</span> height)
<a name="l00323"></a>00323         {
<a name="l00324"></a>00324             <a class="code" href="classpng_1_1image.html#aabd729d366a48f7004c9b169d8783049">m_pixbuf</a>.<a class="code" href="classpng_1_1basic__pixel__buffer.html#a24464e17d19d43102b4ea1ba1e8f75d2" title="Resizes the pixel buffer.">resize</a>(width, height);
<a name="l00325"></a>00325             <a class="code" href="classpng_1_1image.html#a632aa91a796f04152206369cc4403060">m_info</a>.<a class="code" href="classpng_1_1image__info.html#a3d23fc1552357d39fe4d8d017b9bea0a">set_width</a>(width);
<a name="l00326"></a>00326             <a class="code" href="classpng_1_1image.html#a632aa91a796f04152206369cc4403060">m_info</a>.<a class="code" href="classpng_1_1image__info.html#a6ccb5704bf7f715572a6129bf3009761">set_height</a>(height);
<a name="l00327"></a>00327         }
<a name="l00328"></a>00328 
<a name="l00335"></a><a class="code" href="classpng_1_1image.html#a8acc236d81f4d3e799a6d14eab0df297">00335</a>         <a class="code" href="classpng_1_1image.html#a03b16c0f375b4012c4296a1216e793a0" title="Represents a row of image pixel data.">row_type</a>&amp; <a class="code" href="classpng_1_1image.html#a8acc236d81f4d3e799a6d14eab0df297" title="Returns a reference to the row of image data at specified index.">get_row</a>(<span class="keywordtype">size_t</span> index)
<a name="l00336"></a>00336         {
<a name="l00337"></a>00337             <span class="keywordflow">return</span> <a class="code" href="classpng_1_1image.html#aabd729d366a48f7004c9b169d8783049">m_pixbuf</a>.<a class="code" href="classpng_1_1basic__pixel__buffer.html#a4ecc5f4afb12d5d07b8df2d77707e6b2" title="Returns a reference to the row of image data at specified index.">get_row</a>(index);
<a name="l00338"></a>00338         }
<a name="l00339"></a>00339         
<a name="l00346"></a><a class="code" href="classpng_1_1image.html#a6aed7283370ed25f714c4b41c49642ee">00346</a>         <a class="code" href="classpng_1_1image.html#a03b16c0f375b4012c4296a1216e793a0" title="Represents a row of image pixel data.">row_type</a> <span class="keyword">const</span>&amp; <a class="code" href="classpng_1_1image.html#a8acc236d81f4d3e799a6d14eab0df297" title="Returns a reference to the row of image data at specified index.">get_row</a>(<span class="keywordtype">size_t</span> index)<span class="keyword"> const</span>
<a name="l00347"></a>00347 <span class="keyword">        </span>{
<a name="l00348"></a>00348             <span class="keywordflow">return</span> <a class="code" href="classpng_1_1image.html#aabd729d366a48f7004c9b169d8783049">m_pixbuf</a>.<a class="code" href="classpng_1_1basic__pixel__buffer.html#a4ecc5f4afb12d5d07b8df2d77707e6b2" title="Returns a reference to the row of image data at specified index.">get_row</a>(index);
<a name="l00349"></a>00349         }
<a name="l00350"></a>00350 
<a name="l00354"></a><a class="code" href="classpng_1_1image.html#ab68b6275f71b202fbdcbe0147f155bc1">00354</a>         <a class="code" href="classpng_1_1image.html#a03b16c0f375b4012c4296a1216e793a0" title="Represents a row of image pixel data.">row_type</a>&amp; <a class="code" href="classpng_1_1image.html#ab68b6275f71b202fbdcbe0147f155bc1" title="The non-checking version of get_row() method.">operator[]</a>(<span class="keywordtype">size_t</span> index)
<a name="l00355"></a>00355         {
<a name="l00356"></a>00356             <span class="keywordflow">return</span> <a class="code" href="classpng_1_1image.html#aabd729d366a48f7004c9b169d8783049">m_pixbuf</a>[index];
<a name="l00357"></a>00357         }
<a name="l00358"></a>00358         
<a name="l00362"></a><a class="code" href="classpng_1_1image.html#aa15dd8aa344987d4970492101da57130">00362</a>         <a class="code" href="classpng_1_1image.html#a03b16c0f375b4012c4296a1216e793a0" title="Represents a row of image pixel data.">row_type</a> <span class="keyword">const</span>&amp; <a class="code" href="classpng_1_1image.html#ab68b6275f71b202fbdcbe0147f155bc1" title="The non-checking version of get_row() method.">operator[]</a>(<span class="keywordtype">size_t</span> index)<span class="keyword"> const</span>
<a name="l00363"></a>00363 <span class="keyword">        </span>{
<a name="l00364"></a>00364             <span class="keywordflow">return</span> <a class="code" href="classpng_1_1image.html#aabd729d366a48f7004c9b169d8783049">m_pixbuf</a>[index];
<a name="l00365"></a>00365         }
<a name="l00366"></a>00366 
<a name="l00370"></a><a class="code" href="classpng_1_1image.html#abe6726a735ac814dc7ca29fec0c2b914">00370</a>         pixel <a class="code" href="classpng_1_1image.html#abe6726a735ac814dc7ca29fec0c2b914" title="Returns a pixel at (x,y) position.">get_pixel</a>(<span class="keywordtype">size_t</span> x, <span class="keywordtype">size_t</span> y)<span class="keyword"> const</span>
<a name="l00371"></a>00371 <span class="keyword">        </span>{
<a name="l00372"></a>00372             <span class="keywordflow">return</span> <a class="code" href="classpng_1_1image.html#aabd729d366a48f7004c9b169d8783049">m_pixbuf</a>.<a class="code" href="classpng_1_1basic__pixel__buffer.html#a066630b24578f29cc9f380b026fe4a66" title="Returns a pixel at (x,y) position.">get_pixel</a>(x, y);
<a name="l00373"></a>00373         }
<a name="l00374"></a>00374 
<a name="l00378"></a><a class="code" href="classpng_1_1image.html#a4d227ed87e003931410b487ac5d54388">00378</a>         <span class="keywordtype">void</span> <a class="code" href="classpng_1_1image.html#a4d227ed87e003931410b487ac5d54388" title="Replaces a pixel at (x,y) position.">set_pixel</a>(<span class="keywordtype">size_t</span> x, <span class="keywordtype">size_t</span> y, pixel p)
<a name="l00379"></a>00379         {
<a name="l00380"></a>00380             <a class="code" href="classpng_1_1image.html#aabd729d366a48f7004c9b169d8783049">m_pixbuf</a>.<a class="code" href="classpng_1_1basic__pixel__buffer.html#a66bcef0d0f879c0c2cba962fff72f935" title="Replaces a pixel at (x,y) position.">set_pixel</a>(x, y, p);
<a name="l00381"></a>00381         }
<a name="l00382"></a>00382 
<a name="l00383"></a><a class="code" href="classpng_1_1image.html#a4a3b50d010253a4f4384037461a61485">00383</a>         <a class="code" href="namespacepng.html#a4b468278362e4ccf0b2c52f9c0692bdc">interlace_type</a> <a class="code" href="classpng_1_1image.html#a4a3b50d010253a4f4384037461a61485">get_interlace_type</a>()<span class="keyword"> const</span>
<a name="l00384"></a>00384 <span class="keyword">        </span>{
<a name="l00385"></a>00385             <span class="keywordflow">return</span> <a class="code" href="classpng_1_1image.html#a632aa91a796f04152206369cc4403060">m_info</a>.<a class="code" href="classpng_1_1image__info.html#ac43327884ca1d053002cb3ba3ef24188">get_interlace_type</a>();
<a name="l00386"></a>00386         }
<a name="l00387"></a>00387 
<a name="l00388"></a><a class="code" href="classpng_1_1image.html#a97ed2f9073149e205c85a92ca4cfd30d">00388</a>         <span class="keywordtype">void</span> <a class="code" href="classpng_1_1image.html#a97ed2f9073149e205c85a92ca4cfd30d">set_interlace_type</a>(<a class="code" href="namespacepng.html#a4b468278362e4ccf0b2c52f9c0692bdc">interlace_type</a> interlace)
<a name="l00389"></a>00389         {
<a name="l00390"></a>00390             <a class="code" href="classpng_1_1image.html#a632aa91a796f04152206369cc4403060">m_info</a>.<a class="code" href="classpng_1_1image__info.html#a19a24d29c7f47223a8df1164c093361c">set_interlace_type</a>(interlace);
<a name="l00391"></a>00391         }
<a name="l00392"></a>00392 
<a name="l00393"></a><a class="code" href="classpng_1_1image.html#a991a32b1114621d8d669271e36c6c559">00393</a>         <a class="code" href="namespacepng.html#a8437714ca563a374d534e5edf57fbab8">compression_type</a> <a class="code" href="classpng_1_1image.html#a991a32b1114621d8d669271e36c6c559">get_compression_type</a>()<span class="keyword"> const</span>
<a name="l00394"></a>00394 <span class="keyword">        </span>{
<a name="l00395"></a>00395             <span class="keywordflow">return</span> <a class="code" href="classpng_1_1image.html#a632aa91a796f04152206369cc4403060">m_info</a>.<a class="code" href="classpng_1_1image__info.html#ae8f5870c3fd31cc3f0cb158c2a20bbcd">get_compression_type</a>();
<a name="l00396"></a>00396         }
<a name="l00397"></a>00397 
<a name="l00398"></a><a class="code" href="classpng_1_1image.html#ab5dc67b117c120c6b70b0e529e2f6916">00398</a>         <span class="keywordtype">void</span> <a class="code" href="classpng_1_1image.html#ab5dc67b117c120c6b70b0e529e2f6916">set_compression_type</a>(<a class="code" href="namespacepng.html#a8437714ca563a374d534e5edf57fbab8">compression_type</a> compression)
<a name="l00399"></a>00399         {
<a name="l00400"></a>00400             <a class="code" href="classpng_1_1image.html#a632aa91a796f04152206369cc4403060">m_info</a>.<a class="code" href="classpng_1_1image__info.html#a5a645e38fe10f80ced96301cdb0dec74">set_compression_type</a>(compression);
<a name="l00401"></a>00401         }
<a name="l00402"></a>00402 
<a name="l00403"></a><a class="code" href="classpng_1_1image.html#a769c5e2c602abf2d32d1bf2d2b2ab7f3">00403</a>         <a class="code" href="namespacepng.html#ab65439f6689d3a6742450e55f3e0fbce">filter_type</a> <a class="code" href="classpng_1_1image.html#a769c5e2c602abf2d32d1bf2d2b2ab7f3">get_filter_type</a>()<span class="keyword"> const</span>
<a name="l00404"></a>00404 <span class="keyword">        </span>{
<a name="l00405"></a>00405             <span class="keywordflow">return</span> <a class="code" href="classpng_1_1image.html#a632aa91a796f04152206369cc4403060">m_info</a>.<a class="code" href="classpng_1_1image__info.html#a71305d6b01e0c58838144b01d10bbb14">get_filter_type</a>();
<a name="l00406"></a>00406         }
<a name="l00407"></a>00407 
<a name="l00408"></a><a class="code" href="classpng_1_1image.html#a33730d504e3cf4f4a37eaf45e660c55e">00408</a>         <span class="keywordtype">void</span> <a class="code" href="classpng_1_1image.html#a33730d504e3cf4f4a37eaf45e660c55e">set_filter_type</a>(<a class="code" href="namespacepng.html#ab65439f6689d3a6742450e55f3e0fbce">filter_type</a> filter)
<a name="l00409"></a>00409         {
<a name="l00410"></a>00410             <a class="code" href="classpng_1_1image.html#a632aa91a796f04152206369cc4403060">m_info</a>.<a class="code" href="classpng_1_1image__info.html#a886e48b7371f2768acb9fc9768d57366">set_filter_type</a>(filter);
<a name="l00411"></a>00411         }
<a name="l00412"></a>00412 
<a name="l00416"></a><a class="code" href="classpng_1_1image.html#a9cf9a17910aca6c1a542e31292547856">00416</a>         <a class="code" href="namespacepng.html#a6c5f0b8146f3467ea94e6090846d1d01" title="The palette type. Currently implemented as std::vector of png::color.">palette</a>&amp; <a class="code" href="classpng_1_1image.html#a9cf9a17910aca6c1a542e31292547856" title="Returns a reference to the image palette.">get_palette</a>()
<a name="l00417"></a>00417         {
<a name="l00418"></a>00418             <span class="keywordflow">return</span> <a class="code" href="classpng_1_1image.html#a632aa91a796f04152206369cc4403060">m_info</a>.<a class="code" href="classpng_1_1image__info.html#a3577210685e93050122d4974fc1c390a">get_palette</a>();
<a name="l00419"></a>00419         }
<a name="l00420"></a>00420 
<a name="l00424"></a><a class="code" href="classpng_1_1image.html#a328d457f85e7458cd9d691b69a19af30">00424</a>         <a class="code" href="namespacepng.html#a6c5f0b8146f3467ea94e6090846d1d01" title="The palette type. Currently implemented as std::vector of png::color.">palette</a> <span class="keyword">const</span>&amp; <a class="code" href="classpng_1_1image.html#a9cf9a17910aca6c1a542e31292547856" title="Returns a reference to the image palette.">get_palette</a>()<span class="keyword"> const</span>
<a name="l00425"></a>00425 <span class="keyword">        </span>{
<a name="l00426"></a>00426             <span class="keywordflow">return</span> <a class="code" href="classpng_1_1image.html#a632aa91a796f04152206369cc4403060">m_info</a>.<a class="code" href="classpng_1_1image__info.html#a3577210685e93050122d4974fc1c390a">get_palette</a>();
<a name="l00427"></a>00427         }
<a name="l00428"></a>00428 
<a name="l00432"></a><a class="code" href="classpng_1_1image.html#ab1fb2c3e15ac8d90d8436636f9a40da3">00432</a>         <span class="keywordtype">void</span> <a class="code" href="classpng_1_1image.html#ab1fb2c3e15ac8d90d8436636f9a40da3" title="Replaces the image palette.">set_palette</a>(<a class="code" href="namespacepng.html#a6c5f0b8146f3467ea94e6090846d1d01" title="The palette type. Currently implemented as std::vector of png::color.">palette</a> <span class="keyword">const</span>&amp; plte)
<a name="l00433"></a>00433         {
<a name="l00434"></a>00434             <a class="code" href="classpng_1_1image.html#a632aa91a796f04152206369cc4403060">m_info</a>.<a class="code" href="classpng_1_1image__info.html#acfc3675399a946f411d2a6e0054401f4">set_palette</a>(plte);
<a name="l00435"></a>00435         }
<a name="l00436"></a>00436 
<a name="l00437"></a><a class="code" href="classpng_1_1image.html#a96546c2cad0ea9b46f2707609eeb41cf">00437</a>         <a class="code" href="namespacepng.html#ace5f679842b8b4e56df1448c62daf28e" title="The palette transparency map type. Currently implemented as std::vector of png::byte.">tRNS</a> <span class="keyword">const</span>&amp; <a class="code" href="classpng_1_1image.html#a96546c2cad0ea9b46f2707609eeb41cf">get_tRNS</a>()<span class="keyword"> const</span>
<a name="l00438"></a>00438 <span class="keyword">        </span>{
<a name="l00439"></a>00439             <span class="keywordflow">return</span> <a class="code" href="classpng_1_1image.html#a632aa91a796f04152206369cc4403060">m_info</a>.<a class="code" href="classpng_1_1image__info.html#a9dfd2ebd5421d27c1ed839262e995650">get_tRNS</a>();
<a name="l00440"></a>00440         }
<a name="l00441"></a>00441 
<a name="l00442"></a><a class="code" href="classpng_1_1image.html#a7bcaa3ed96d6b62f3e162c88ffd99da4">00442</a>         <a class="code" href="namespacepng.html#ace5f679842b8b4e56df1448c62daf28e" title="The palette transparency map type. Currently implemented as std::vector of png::byte.">tRNS</a>&amp; <a class="code" href="classpng_1_1image.html#a96546c2cad0ea9b46f2707609eeb41cf">get_tRNS</a>()
<a name="l00443"></a>00443         {
<a name="l00444"></a>00444             <span class="keywordflow">return</span> <a class="code" href="classpng_1_1image.html#a632aa91a796f04152206369cc4403060">m_info</a>.<a class="code" href="classpng_1_1image__info.html#a9dfd2ebd5421d27c1ed839262e995650">get_tRNS</a>();
<a name="l00445"></a>00445         }
<a name="l00446"></a>00446 
<a name="l00447"></a><a class="code" href="classpng_1_1image.html#a3a451d07b9342ae53c459b5e6e0a8f56">00447</a>         <span class="keywordtype">void</span> <a class="code" href="classpng_1_1image.html#a3a451d07b9342ae53c459b5e6e0a8f56">set_tRNS</a>(<a class="code" href="namespacepng.html#ace5f679842b8b4e56df1448c62daf28e" title="The palette transparency map type. Currently implemented as std::vector of png::byte.">tRNS</a> <span class="keyword">const</span>&amp; trns)
<a name="l00448"></a>00448         {
<a name="l00449"></a>00449             <a class="code" href="classpng_1_1image.html#a632aa91a796f04152206369cc4403060">m_info</a>.<a class="code" href="classpng_1_1image__info.html#a939bed5115330604e67950dc63b555e3">set_tRNS</a>(trns);
<a name="l00450"></a>00450         }
<a name="l00451"></a>00451 
<a name="l00452"></a>00452     <span class="keyword">protected</span>:
<a name="l00457"></a>00457         <span class="keyword">template</span>&lt; <span class="keyword">typename</span> base_impl &gt;
<a name="l00458"></a><a class="code" href="classpng_1_1image_1_1streaming__impl.html">00458</a>         <span class="keyword">class </span><a class="code" href="classpng_1_1image_1_1streaming__impl.html" title="A common base class template for pixel_consumer and pixel_generator classes.">streaming_impl</a>
<a name="l00459"></a>00459             : <span class="keyword">public</span> base_impl
<a name="l00460"></a>00460         {
<a name="l00461"></a>00461         <span class="keyword">public</span>:
<a name="l00462"></a><a class="code" href="classpng_1_1image_1_1streaming__impl.html#a6176ec806d0d3f8dd163d492ea20d6ea">00462</a>             <a class="code" href="classpng_1_1image_1_1streaming__impl.html#a6176ec806d0d3f8dd163d492ea20d6ea">streaming_impl</a>(<a class="code" href="classpng_1_1image__info.html" title="Holds information about PNG image.">image_info</a>&amp; <a class="code" href="classpng_1_1info.html" title="Holds information about PNG image. Adapter class for IO image operations.">info</a>, <a class="code" href="classpng_1_1pixel__buffer.html">pixbuf</a>&amp; pixels)
<a name="l00463"></a>00463                 : base_impl(info),
<a name="l00464"></a>00464                   <a class="code" href="classpng_1_1image_1_1streaming__impl.html#acc28116577b5d265e6d04891c6217261">m_pixbuf</a>(pixels)
<a name="l00465"></a>00465             {
<a name="l00466"></a>00466             }
<a name="l00467"></a>00467 
<a name="l00472"></a><a class="code" href="classpng_1_1image_1_1streaming__impl.html#afadbec0efd903bef032b1736c459b548">00472</a>             <a class="code" href="namespacepng.html#ac0e0e2e09bdd9a287618bfdc5f31ca52">byte</a>* <a class="code" href="classpng_1_1image_1_1streaming__impl.html#afadbec0efd903bef032b1736c459b548" title="Returns the starting address of a pos-th row in the image&#39;s pixel buffer.">get_next_row</a>(<span class="keywordtype">size_t</span> pos)
<a name="l00473"></a>00473             {
<a name="l00474"></a>00474                 <span class="keyword">typedef</span> <span class="keyword">typename</span> <a class="code" href="classpng_1_1row__traits_3_01std_1_1vector_3_01pixel_01_4_01_4.html" title="The row_traits specialization for unpacked pixel rows.">pixbuf::row_traits</a> row_traits;
<a name="l00475"></a>00475                 <span class="keywordflow">return</span> <span class="keyword">reinterpret_cast&lt;</span> <a class="code" href="namespacepng.html#ac0e0e2e09bdd9a287618bfdc5f31ca52">byte</a>* <span class="keyword">&gt;</span>
<a name="l00476"></a>00476                     (row_traits::get_data(<a class="code" href="classpng_1_1image_1_1streaming__impl.html#acc28116577b5d265e6d04891c6217261">m_pixbuf</a>.<a class="code" href="classpng_1_1basic__pixel__buffer.html#a4ecc5f4afb12d5d07b8df2d77707e6b2" title="Returns a reference to the row of image data at specified index.">get_row</a>(pos)));
<a name="l00477"></a>00477             }
<a name="l00478"></a>00478 
<a name="l00479"></a>00479         <span class="keyword">protected</span>:
<a name="l00480"></a><a class="code" href="classpng_1_1image_1_1streaming__impl.html#acc28116577b5d265e6d04891c6217261">00480</a>             <a class="code" href="classpng_1_1pixel__buffer.html">pixbuf</a>&amp; <a class="code" href="classpng_1_1image_1_1streaming__impl.html#acc28116577b5d265e6d04891c6217261">m_pixbuf</a>;
<a name="l00481"></a>00481         };
<a name="l00482"></a>00482 
<a name="l00486"></a><a class="code" href="classpng_1_1image_1_1pixel__consumer.html">00486</a>         <span class="keyword">class </span><a class="code" href="classpng_1_1image_1_1pixel__consumer.html" title="The pixel buffer adapter for reading pixel data.">pixel_consumer</a>
<a name="l00487"></a>00487             : <span class="keyword">public</span> <a class="code" href="classpng_1_1image_1_1streaming__impl.html" title="A common base class template for pixel_consumer and pixel_generator classes.">streaming_impl</a>&lt; consumer&lt; pixel,
<a name="l00488"></a>00488                                                pixel_consumer,
<a name="l00489"></a>00489                                                image_info_ref_holder,
<a name="l00490"></a>00490                                                <span class="comment">/* interlacing = */</span> true &gt; &gt;
<a name="l00491"></a>00491         {
<a name="l00492"></a>00492         <span class="keyword">public</span>:
<a name="l00493"></a><a class="code" href="classpng_1_1image_1_1pixel__consumer.html#a635b7414e88321adb39a21c9814ba23e">00493</a>             <a class="code" href="classpng_1_1image_1_1pixel__consumer.html#a635b7414e88321adb39a21c9814ba23e">pixel_consumer</a>(<a class="code" href="classpng_1_1image__info.html" title="Holds information about PNG image.">image_info</a>&amp; <a class="code" href="classpng_1_1info.html" title="Holds information about PNG image. Adapter class for IO image operations.">info</a>, <a class="code" href="classpng_1_1pixel__buffer.html">pixbuf</a>&amp; pixels)
<a name="l00494"></a>00494                 : <a class="code" href="classpng_1_1image_1_1streaming__impl.html" title="A common base class template for pixel_consumer and pixel_generator classes.">streaming_impl</a>&lt; <a class="code" href="classpng_1_1consumer.html" title="Pixel consumer class template.">consumer</a>&lt; pixel,
<a name="l00495"></a>00495                                             <a class="code" href="classpng_1_1image_1_1pixel__consumer.html" title="The pixel buffer adapter for reading pixel data.">pixel_consumer</a>,
<a name="l00496"></a>00496                                             <a class="code" href="classpng_1_1image__info__ref__holder.html" title="An image_info holder class. Stores a reference to the image_info object. The image_info object itself...">image_info_ref_holder</a>,
<a name="l00497"></a>00497                                             true &gt; &gt;(info, pixels)
<a name="l00498"></a>00498             {
<a name="l00499"></a>00499             }
<a name="l00500"></a>00500 
<a name="l00501"></a><a class="code" href="classpng_1_1image_1_1pixel__consumer.html#a99fe77d0a8fb981e3b92280065dc0b69">00501</a>             <span class="keywordtype">void</span> <a class="code" href="classpng_1_1image_1_1pixel__consumer.html#a99fe77d0a8fb981e3b92280065dc0b69">reset</a>(<span class="keywordtype">size_t</span> pass)
<a name="l00502"></a>00502             {
<a name="l00503"></a>00503                 <span class="keywordflow">if</span> (pass == 0)
<a name="l00504"></a>00504                 {
<a name="l00505"></a>00505                     this-&gt;<a class="code" href="classpng_1_1image_1_1streaming__impl.html#acc28116577b5d265e6d04891c6217261">m_pixbuf</a>.<a class="code" href="classpng_1_1basic__pixel__buffer.html#a24464e17d19d43102b4ea1ba1e8f75d2" title="Resizes the pixel buffer.">resize</a>(this-&gt;get_info().<a class="code" href="classpng_1_1image.html#a381477824c5c49c922abf7a050b4a7f3">get_width</a>(),
<a name="l00506"></a>00506                                           this-&gt;get_info().<a class="code" href="classpng_1_1image.html#a2b7a1e585b83533491dca1437072d7c6">get_height</a>());
<a name="l00507"></a>00507                 }
<a name="l00508"></a>00508             }
<a name="l00509"></a>00509         };
<a name="l00510"></a>00510 
<a name="l00514"></a><a class="code" href="classpng_1_1image_1_1pixel__generator.html">00514</a>         <span class="keyword">class </span><a class="code" href="classpng_1_1image_1_1pixel__generator.html" title="The pixel buffer adapter for writing pixel data.">pixel_generator</a>
<a name="l00515"></a>00515             : <span class="keyword">public</span> <a class="code" href="classpng_1_1image_1_1streaming__impl.html" title="A common base class template for pixel_consumer and pixel_generator classes.">streaming_impl</a>&lt; generator&lt; pixel,
<a name="l00516"></a>00516                                                 pixel_generator,
<a name="l00517"></a>00517                                                 image_info_ref_holder,
<a name="l00518"></a>00518                                                 <span class="comment">/* interlacing = */</span> true &gt; &gt;
<a name="l00519"></a>00519         {
<a name="l00520"></a>00520         <span class="keyword">public</span>:
<a name="l00521"></a><a class="code" href="classpng_1_1image_1_1pixel__generator.html#afce8ad59d535b16ab5076c0ac8b8df88">00521</a>             <a class="code" href="classpng_1_1image_1_1pixel__generator.html#afce8ad59d535b16ab5076c0ac8b8df88">pixel_generator</a>(<a class="code" href="classpng_1_1image__info.html" title="Holds information about PNG image.">image_info</a>&amp; <a class="code" href="classpng_1_1info.html" title="Holds information about PNG image. Adapter class for IO image operations.">info</a>, <a class="code" href="classpng_1_1pixel__buffer.html">pixbuf</a>&amp; pixels)
<a name="l00522"></a>00522                 : <a class="code" href="classpng_1_1image_1_1streaming__impl.html" title="A common base class template for pixel_consumer and pixel_generator classes.">streaming_impl</a>&lt; <a class="code" href="classpng_1_1generator.html" title="Pixel generator class template.">generator</a>&lt; pixel,
<a name="l00523"></a>00523                                              <a class="code" href="classpng_1_1image_1_1pixel__generator.html" title="The pixel buffer adapter for writing pixel data.">pixel_generator</a>,
<a name="l00524"></a>00524                                              <a class="code" href="classpng_1_1image__info__ref__holder.html" title="An image_info holder class. Stores a reference to the image_info object. The image_info object itself...">image_info_ref_holder</a>,
<a name="l00525"></a>00525                                              true &gt; &gt;(info, pixels)
<a name="l00526"></a>00526             {
<a name="l00527"></a>00527             }
<a name="l00528"></a>00528         };
<a name="l00529"></a>00529 
<a name="l00530"></a><a class="code" href="classpng_1_1image.html#a632aa91a796f04152206369cc4403060">00530</a>         <a class="code" href="classpng_1_1image__info.html" title="Holds information about PNG image.">image_info</a> <a class="code" href="classpng_1_1image.html#a632aa91a796f04152206369cc4403060">m_info</a>;
<a name="l00531"></a><a class="code" href="classpng_1_1image.html#aabd729d366a48f7004c9b169d8783049">00531</a>         <a class="code" href="classpng_1_1pixel__buffer.html">pixbuf</a> <a class="code" href="classpng_1_1image.html#aabd729d366a48f7004c9b169d8783049">m_pixbuf</a>;
<a name="l00532"></a>00532     };
<a name="l00533"></a>00533 
<a name="l00534"></a>00534 } <span class="comment">// namespace png</span>
<a name="l00535"></a>00535 
<a name="l00536"></a>00536 <span class="preprocessor">#endif // PNGPP_IMAGE_HPP_INCLUDED</span>
</pre></div></div><!-- contents -->


<hr class="footer"/><address class="footer"><small>
Generated on Fri Jan 25 2013 14:10:10 for png++ by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>

</body>
</html>
